jQuery(document).ready(function() {
	//make some charts
	jQuery('table.pie').visualize({type: 'pie', pieMargin: 10, title: '2009 Total Sales by Individual', width: 450});
	jQuery('table.line').visualize({type: 'line', title: '2009 Total Sales by Individual', width: 450});
	jQuery('table.area').visualize({type: 'area'});
	jQuery('table.bar').visualize({type: 'bar', barDirection: 'horizontal'});
    
	jQuery('.inlinesparkline').sparkline();
    jQuery('.inlinebar').sparkline('html', {type: 'bar', barColor: 'red'} );

    
    jQuery('table.line_filter').visualize({
		type: 'line',
		labelFilter: function(label) {
			// If this is a number, then format as money
			// with a $ and two decimal places
			if(!isNaN(label) && parseFloat(label)) {
				var dec = 2;
				// Round number to correct decimal places
				label = Math.round(label*Math.pow(10,dec))/Math.pow(10,dec);
				// Pad decimals if necessary, i.e. 9.5 -> 9.50
				return 'jQuery ' + label.toFixed(dec);
			}
			else if(isString(label)) {
				// I know we can use css to style capitalization.
				// This is simply to demonstrate how we can conditionally
				// filter string-type lables if needed
				// borrowed from http://phpjs.org/functions/ucwords:569
				return (label + '').replace(/^([a-z])|\s+([a-z])/g, function (jQuery1) {
					return jQuery1.toUpperCase();
				});
			}
			return label;
		}
	});
    
    jQuery('table.pie').hide();
    jQuery('table.line').hide();
    jQuery('table.area').hide();
    jQuery('table.bar').hide();
	
});


function isString_function_javascript() {
	
	if (typeof arguments[0] == 'string') return true;
	if (typeof arguments[0] == 'object') {  
		var criterion = arguments[0].constructor.toString().match(/string/i); 
		return (criterion != null);  
	}
	return false;
	
}
